package com.example.binpacking.controller;

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.example.binpacking.model.GoodsSize;
import com.example.binpacking.model.OrderMessage;
import com.example.binpacking.model.Result;
import com.example.binpacking.service.Impl.OrderMessageServiceImpl;
import com.example.binpacking.service.OrderMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Slf4j
@RestController
@RequestMapping("/ordermessage")
public class OrderMessageController {
    @Autowired
    private OrderMessageService orderMessageService;
    @GetMapping("/select")
    public Result findOrderByTime(
            @RequestParam("startTime")  String startTime,
            @RequestParam("endTime")  String endTime
    ){
        log.info("查询全部时间段产品尺寸与信息");

        List<OrderMessage> list = orderMessageService.findOrderByTime(startTime,endTime);
        return Result.success(list);

    }
    @GetMapping("/selectByTime")
    public Result findOrderByFixedTime(){
        log.info("查询全部时间段产品尺寸与信息");
        List<OrderMessage> list = orderMessageService.selectByTime();
        return Result.success(list);

    }
}
